package com.liyang.microsevice.application1.controller;



import com.liyang.microservice.service1.api.ConsumerService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Administrator
 * @version 1.0
 * @Title: ConsumerController
 * @description TODO
 * @date 2021/4/24 0024 20:36
 */
@RestController
public class Application1Controller {
    @Resource
    private ApplicationContext applicationContext;

    @DubboReference
    private ConsumerService consumerService;

    @GetMapping("/service")
    public String service() {
        String service = consumerService.service();
        return "test |"+service;
    }


    @GetMapping(value="/configs2")
    public String getConfigs2(){
        String name1=applicationContext.getEnvironment().getProperty("name");
        String name=applicationContext.getEnvironment().getProperty("common.name");
        String age=applicationContext.getEnvironment().getProperty("common.age");
        String address=applicationContext.getEnvironment().getProperty("common.address");
        String birthday=applicationContext.getEnvironment().getProperty("common.birthday");
        String fullName=applicationContext.getEnvironment().getProperty("common.fullName");
        return name+"+"+age+"+"+address+"+"+birthday+"+"+fullName+"+ name1:"+name1;}

}